import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:getwidget/colors/gf_color.dart';
import 'package:getwidget/components/list_tile/gf_list_tile.dart';
import 'package:getwidget/components/toast/gf_toast.dart';
import 'package:getwidget/position/gf_toast_position.dart';

import '../controllers/gftoast_controller.dart';

class GftoastView extends GetView<GftoastController> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('提示框'),
        centerTitle: true,
      ),
      body: Container(
        margin: EdgeInsets.all(10),
        child: ListView(
          children: [
            GestureDetector(
              onTap: () => GFToast.showToast(
                'GetFlutter is an open source library that comes with pre-build 1000+ UI components.',
                context,
                toastPosition: GFToastPosition.BOTTOM,
              ),
              child: Container(
                margin: const EdgeInsets.only(left: 15, right: 15, top: 20),
                padding: const EdgeInsets.all(5),
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.all(Radius.circular(7)),
                  color: GFColors.DARK,
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.40), 
                      blurRadius: 5
                    )
                  ]
                ),
                child: GFListTile(
                  color: GFColors.DARK,
                  title: const Text(
                    'Show Toast',
                    style: TextStyle(color: GFColors.WHITE),
                  ),
                  icon: Icon(
                    CupertinoIcons.forward,
                    color: GFColors.SUCCESS,
                  )
                ),
              )
            ),

            GestureDetector(
              onTap: () => GFToast.showToast(
                'GetFlutter is an open source library that comes with pre-build 1000+ UI components.',
                context,
                toastPosition: GFToastPosition.BOTTOM,
                textStyle: TextStyle(fontSize: 16, color: GFColors.DARK),
                backgroundColor: GFColors.LIGHT,
                trailing: Icon(
                  Icons.notifications,
                  color: GFColors.SUCCESS,
                )
              ),
              child: Container(
                margin: const EdgeInsets.only(left: 15, right: 15, top: 20),
                padding: const EdgeInsets.all(5),
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.all(Radius.circular(7)),
                  color: GFColors.DARK,
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.40), 
                      blurRadius: 5
                    )
                  ]
                ),
                child: GFListTile(
                  color: GFColors.DARK,
                  title: const Text(
                    'Show Toast with trailing',
                    style: TextStyle(color: GFColors.WHITE),
                  ),
                  icon: Icon(
                    CupertinoIcons.forward,
                    color: GFColors.SUCCESS,
                  )
                ),
              )
            ),

            GestureDetector(
              onTap: () => GFToast.showToast(
                'GetFlutter is an open source library that comes with pre-build 1000+ UI components.',
                context,
                toastPosition: GFToastPosition.BOTTOM,
              ),
              child: Container(
                margin: const EdgeInsets.only(left: 15, right: 15, top: 20),
                padding: const EdgeInsets.all(5),
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.all(Radius.circular(7)),
                  color: GFColors.DARK,
                  boxShadow: [
                    BoxShadow(
                      color: Colors.black.withOpacity(0.40), 
                      blurRadius: 5
                    )
                  ]
                ),
                child: GFListTile(
                  color: GFColors.DARK,
                  title: const Text(
                    'Show Toast with toast position',
                    style: TextStyle(color: GFColors.WHITE),
                  ),
                  icon: Icon(
                    CupertinoIcons.forward,
                    color: GFColors.SUCCESS,
                  )
                ),
              )
            ),
          ],
        ),
      ),
    );
  }
}
